﻿
using System.Linq;
using System.Collections.Generic;
namespace MoneyManagerNET.Model
{
    public static class StockAccountExtensions
    {
        //------------------
        //---IStockAccount--
        //------------------
        public static decimal GetGainLoss(this IStockAccount stockAccount){return stockAccount.StockAcquirements.Sum(investment => investment.GetGainLoss());}
        public static decimal GetInvested(this IStockAccount stockAccount) { return stockAccount.StockAcquirements.Sum(tran => tran.PurchasePrice * tran.StockCount); }
        public static decimal GetTotal(this IStockAccount stockAccount) { return stockAccount.StockAcquirements.Sum(tran => tran.CurrentPrice * tran.StockCount); }
    }
}